package org.example.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private String msg;
    private Object data;
    private Integer code;

    public  static  Result success(Object data) {
        return new Result("success", data, 200);
    }

    public  static  Result success() {
        return new Result("success", null, 200);
    }

    public  static  Result serveError(String msg) {
        return new Result(msg, null, 500);
    }

    public  static  Result clientError(String msg) {
        return new Result(msg, null, 400);
    }

    public  static  Result successList(Query data) {
        return new Result("success", data, 200);
    }
}
